package com.yunxitest.yunxitest.item.audio.`in`

import java.nio.ByteBuffer
import java.util.concurrent.LinkedBlockingQueue

abstract class BaseAudioSource(val streamId: Int, queue: LinkedBlockingQueue<ByteBuffer>?) {
    protected val STATUS_RUNNING = 1
    protected val STATUS_STOP = 0
    protected val STATUS_INIT = -1

    protected var status = STATUS_INIT
    var enableStatus = false

    abstract fun startRecord()
    abstract fun stopRecord()
    abstract fun close()

    fun isWorking(): Boolean {
        return status != STATUS_INIT
    }

    fun onEnableStatusChanged(enable: Boolean) {
        enableStatus = enable
    }

    open fun resume() {

    }

    open fun onData(buffer: ByteBuffer) {
    }

}